package com.esri.core.geometry;

/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class VertexDescriptionDesignerImpl extends VertexDescription {
    protected boolean m_bModified;

    public VertexDescriptionDesignerImpl() {
        this.b = new int[10];
        this.b[0] = 0;
        this.a = 1;
        this.c = new int[10];
        for (int i = 0; i < 10; i++) {
            this.c[i] = -1;
        }
        this.c[this.b[0]] = 0;
        this.m_bModified = true;
    }

    public VertexDescriptionDesignerImpl(VertexDescription vertexDescription) {
        super(vertexDescription.hashCode(), vertexDescription);
        this.m_bModified = true;
    }

    public void addAttribute(int i) {
        if (hasAttribute(i)) {
            return;
        }
        this.c[i] = 0;
        _initMapping();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public void c(int i) {
        if (i == 0) {
            throw new IllegalArgumentException("Position attribue cannot be removed");
        }
        if (hasAttribute(i)) {
            this.c[i] = -1;
            _initMapping();
        }
    }

    public void reset() {
        this.b[0] = 0;
        this.a = 1;
        for (int i : this.c) {
            this.c[i] = -1;
        }
        this.c[this.b[0]] = 0;
        this.m_bModified = true;
    }

    public VertexDescription getDescription() {
        return VertexDescriptionHash.getInstance().add(this);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public static VertexDescription d() {
        return VertexDescriptionHash.getInstance().getVD2D();
    }

    static VertexDescription e() {
        return VertexDescriptionHash.getInstance().getVD3D();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public VertexDescription f() {
        return new VertexDescription(hashCode(), this);
    }

    protected void _initMapping() {
        this.a = 0;
        int i = 0;
        for (int i2 = 0; i2 < 10; i2++) {
            if (this.c[i2] >= 0) {
                this.b[i] = i2;
                this.c[i2] = i;
                i++;
                this.a++;
            }
        }
        this.m_bModified = true;
    }

    @Override // com.esri.core.geometry.VertexDescription
    public int hashCode() {
        if (this.m_bModified) {
            this.d = a();
            this.m_bModified = false;
        }
        return this.d;
    }

    @Override // com.esri.core.geometry.VertexDescription
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (obj == this) {
            return true;
        }
        if (obj.getClass() != getClass()) {
            return false;
        }
        VertexDescriptionDesignerImpl vertexDescriptionDesignerImpl = (VertexDescriptionDesignerImpl) obj;
        if (vertexDescriptionDesignerImpl.getAttributeCount() != getAttributeCount()) {
            return false;
        }
        for (int i = 0; i < this.a; i++) {
            if (this.b[i] != vertexDescriptionDesignerImpl.b[i]) {
                return false;
            }
        }
        return this.m_bModified == vertexDescriptionDesignerImpl.m_bModified;
    }

    public boolean isDesignerFor(VertexDescription vertexDescription) {
        if (vertexDescription.getAttributeCount() != getAttributeCount()) {
            return false;
        }
        for (int i = 0; i < this.a; i++) {
            if (this.b[i] != vertexDescription.b[i]) {
                return false;
            }
        }
        return true;
    }
}
